import java.util.*;
abstract class Animal{
    private String name;  //名字
    private int age;   //年龄

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
}

interface IAbility{
    void showInfo();  //输出动物信息
    void cry();    //动物发出叫声
}

class Dog extends Animal implements IAbility{
    Dog(String name,int age){
        super(name,age);
    }

    public void showInfo(){
        System.out.println("我是一只狗,我的名字是"+getName()+",今年"+getAge()+"岁");
    }

    public void cry(){
        System.out.println("旺旺");
    }
}

class Cat extends Animal implements IAbility{
    Cat(String name,int age){
        super(name,age);
    }

    public void showInfo(){
        System.out.println("我是一只猫,我的名字是"+getName()+",今年"+getAge()+"岁");
    }

    public void cry(){
        System.out.println("喵喵");
    }
}

class Simulator{
    void playSound(IAbility animal){
        animal.showInfo();
        animal.cry();
        Animal ani = (Animal)animal;
        System.out.println(ani.getName()+"\n"+ani.getAge());
    }
}

public class Main6 {

    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        IAbility animal=null;
        int type=input.nextInt();
        String name=input.next();
        int age=input.nextInt();
        if (type==1)
            animal=new Dog(name,age);
        else
            animal=new Cat(name,age);

        Simulator sim=new Simulator();
        sim.playSound(animal);
        input.close();
    }
}
